<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="./Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="./Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./Public/Admin/Flat/img/favicon.ico">
	   
	   <!--上传插件开始  注意顺序！！！，必须是这个顺序，否则出不来-->
	   <script type="text/javascript" src="./Public/uploadify/jquery-1.8.2.min.js"></script>
	   <script type="text/javascript" src="./Public/uploadify/jquery.uploadify.min.js"></script>
	   <link rel="stylesheet" type="text/css" href="./Public/uploadify/uploadify.css"/>
	   <!--上传插件结束-->
	   
	   
	</head>
	<body>
		<form action="" method="post" enctype="multipart/form-data">
		<div class="alert alert-success">添加品牌</div>
		<div class="form-group">
			<label for="exampleInputEmail1">品牌名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" name="bname">
		</div>
		
		<div class="form-group">
			<label for="file">缩略图</label>
			<input id="file" type="file" name="logo">
			<script type="text/javascript">
		        $(function() {
		            $('#file').uploadify({
		                'formData'     : {//POST数据
		                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
		                },
		                'fileTypeDesc' : '上传文件',//上传描述
		                'fileTypeExts' : '*.jpg;*.png',
		                'swf'      : '<?php echo __PUBLIC__?>/uploadify/uploadify.swf',
		                'uploader' : '<?php echo U('upload')?>',
		                'buttonText':'选择文件',
		                'fileSizeLimit' : '2000KB',
		                'uploadLimit' : 1,//上传文件数
		                'width':65,
		                'height':25,
		                'successTimeout':10,//等待服务器响应时间
		                'removeTimeout' : 0.2,//成功显示时间
		                'onUploadSuccess' : function(file, data, response) {
							//转为json
		                    data=$.parseJSON(data);
		                    //获得图片地址
		                    var imageUrl = data.url;
		                    var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' style='width:200px;' /><input type='hidden' name='logo' value='"+data.path+"'/></li>";
//		                    给id=file 添加value值，以便传到后台调用
//							$("#file").attr('value',imageUrl);
		                    $("#uploadList ul").prepend(li);
		                }
		            });
		        });
		    </script>
			<div id="uploadList">
		        <ul>
		
		        </ul>
		    </div>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail3">排序</label>
			<input id="exampleInputEmail3" class="form-control" type="text" name="sort" value="100">
		</div>
		<div class="form-group">
			<label>是否热门：</label>
			<label for="exampleInputEmail5">不热门</label>
			<input type="radio" name="ishot" id="exampleInputEmail5" value="0" />
			<label for="exampleInputEmail6">热门</label>
			<input type="radio" name="ishot" id="exampleInputEmail6" value="1" checked="checked" />
		</div>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>
</html>
